






import bpy
from bpy.types import Operator
from 全局控制.Node.节点和插座基类.bl_UpdateNode import *
import 全局控制.Node.节点和插座基类.bl_节点基类 as 基类

类型枚举 = [
	("TYPE_手动", "手动", "", 0),
	("标识_逐帧", "逐帧", "", 1),
]


class C_SN_List移除元素(基类.C_SN_基类):
	bl_dname = 'bl_node_List移除元素'
	bl_label = 'List移除元素'
	
	def init(self, context):
		super(C_SN_List移除元素, self).__init__()
		self.inputs.new('C_NS_List_T', name='List')
		self.inputs.new('C_NS_List_T', name='Value')
		self.outputs.new('C_NS_List_T', name='List')
		
	def draw_buttons(self, context, layout):
		#self.inputs
		pass

	def f_update(self, 是否向下传递=False, input插座=None):
		key = self.inputs['截取索引'].f_getData()
		obj = self.inputs['物体列表'].f_getData(int(key))
		
		self.outputs['选区物体'].f_setData(obj)
		#print('物体选择 = ', self.name, input插座)
		super(C_SN_List移除元素, self).f_update(是否向下传递, input插座)

	


class C_NODE_MENU_List移除元素(bpy.types.Operator):
	bl_idname = 'node.global_node_intercept_object'
	bl_label = 'Add 物体选择'
	bl_options = {'REGISTER', 'UNDO'}

	def execute(operator, context):
		operator.use_transform = True
		bpy.ops.node.add_node(type='C_SN_List移除元素', use_transform=True)
		return {'FINISHED'}



classes = (
	C_SN_List移除元素,
	C_NODE_MENU_List移除元素,
)

def register():
	for c in classes:
		bpy.utils.register_class(c)
		

def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)






